package org.example;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;



@WebServlet("/a")
public class AnServlet extends HttpServlet {
    //init初始化方法
    @Override
    public void init() throws ServletException {
        super.init();
        System.out.println("inited");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("Get方法");
        resp.getWriter().println("AnServlet");
    }
    //destroy销毁方法
    @Override
    public void destroy() {
        super.destroy();
    }
}


